package org.omg.CORBA;

/** 
 * Helper class for : DefinitionKind
 *  
 * @author OpenORB Compiler
 */ 
public class DefinitionKindHelper
{
    /**
     * Insert DefinitionKind into an any
     * @param a an any
     * @param t DefinitionKind value
     */
    public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.DefinitionKind t)
    {
        a.type(type());
        write(a.create_output_stream(),t);
    }

    /**
     * Extract DefinitionKind from an any
     *
     * @param a an any
     * @return the extracted DefinitionKind value
     */
    public static org.omg.CORBA.DefinitionKind extract( org.omg.CORBA.Any a )
    {
        if ( !a.type().equivalent( type() ) )
        {
            throw new org.omg.CORBA.MARSHAL();
        }
        return read( a.create_input_stream() );
    }

    //
    // Internal TypeCode value
    //
    private static org.omg.CORBA.TypeCode _tc = null;

    /**
     * Return the DefinitionKind TypeCode
     * @return a TypeCode
     */
    public static org.omg.CORBA.TypeCode type()
    {
        if (_tc == null) {
            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
            String []_members = new String[ 26 ];
            _members[ 0 ] = "dk_none";
            _members[ 1 ] = "dk_all";
            _members[ 2 ] = "dk_Attribute";
            _members[ 3 ] = "dk_Constant";
            _members[ 4 ] = "dk_Exception";
            _members[ 5 ] = "dk_Interface";
            _members[ 6 ] = "dk_Module";
            _members[ 7 ] = "dk_Operation";
            _members[ 8 ] = "dk_Typedef";
            _members[ 9 ] = "dk_Alias";
            _members[ 10 ] = "dk_Struct";
            _members[ 11 ] = "dk_Union";
            _members[ 12 ] = "dk_Enum";
            _members[ 13 ] = "dk_Primitive";
            _members[ 14 ] = "dk_String";
            _members[ 15 ] = "dk_Sequence";
            _members[ 16 ] = "dk_Array";
            _members[ 17 ] = "dk_Repository";
            _members[ 18 ] = "dk_Wstring";
            _members[ 19 ] = "dk_Fixed";
            _members[ 20 ] = "dk_Value";
            _members[ 21 ] = "dk_ValueBox";
            _members[ 22 ] = "dk_ValueMember";
            _members[ 23 ] = "dk_Native";
            _members[ 24 ] = "dk_AbstractInterface";
            _members[ 25 ] = "dk_LocalInterface";
            _tc = orb.create_enum_tc( id(), "DefinitionKind", _members );
        }
        return _tc;
    }

    /**
     * Return the DefinitionKind IDL ID
     * @return an ID
     */
    public static String id()
    {
        return _id;
    }

    private final static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0";

    /**
     * Read DefinitionKind from a marshalled stream
     * @param istream the input stream
     * @return the readed DefinitionKind value
     */
    public static org.omg.CORBA.DefinitionKind read(org.omg.CORBA.portable.InputStream istream)
    {
        return DefinitionKind.from_int(istream.read_ulong());
    }

    /**
     * Write DefinitionKind into a marshalled stream
     * @param ostream the output stream
     * @param value DefinitionKind value
     */
    public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value)
    {
        ostream.write_ulong(value.value());
    }

}
